import bisect

# 请在此输入您的代码
nums = []


# 确定了4位剩余5位 前方i位后方5-i位
def generate(num):
    nums1 = list(range(0, pow(10, num)))
    nums2 = list(range(0, pow(10, 5 - num)))
    ans = []
    for n1 in nums1:
        for n2 in nums2:
            ans.append(n1 * pow(10, 9 - num) + 4931 * pow(10, 5 - num) + n2)
    return ans


for i in range(0, 6):
    nums.extend(generate(i))
nums = list(set(nums))
nums.sort()


def bisect_less_equal(array, target):
    l = 0
    r = len(array) - 1
    while l <= r:
        mid = (l + r) >> 1
        if array[mid] <= target:
            l = mid + 1
        else:
            r = mid - 1
    return l - 1


l, r = map(int, input().split())
li = bisect.bisect_left(nums, l)
ri = bisect_less_equal(nums, r)
print(sum(nums[li:ri + 1]))
